package goleetcode

func differenceOfSum(nums []int) int {
	total := 0
	digitSum := 0
	for _, num := range nums {
		total += num
		for num != 0 {
			digitSum += num % 10
			num /= 10
		}
	}
	if total > digitSum {
		return total - digitSum
	}
	return digitSum - total
}